package com.zhima.util;

import cn.hutool.core.util.StrUtil;

import static com.zhima.constant.RegexConstant.*;

public class RegexUtil {
    public static boolean validatePhone(String phone) {
        return isNotEmpty(phone) && PHONE_REGEX.matcher(phone).find();
    }

    public static boolean validateEmail(String email) {
        return isNotEmpty(email) && EMAIL_REGEX.matcher(email).find();
    }

    public static boolean validatePassword(String password) {
        return isNotEmpty(password) && PASSWORD_REGEX.matcher(password).find();
    }

    public static boolean isNotEmpty(String str) {
        return str != null && StrUtil.isNotEmpty(str);
    }
}
